#ifndef __IPADDRESSEDIT_H__
#define __IPADDRESSEDIT_H__


namespace DuiLib
{
	class CIPEditWnd;

	#define DotWidth 5
	#define EditColor 
	class  CIPEditUI : public CLabelUI
	{
		friend class CIPEditWnd;
	public:
		CIPEditUI();
		LPCTSTR GetClass() const;
		UINT GetControlFlags() const;
		void SetEnabled(bool bEnable = true);
		void SetText(LPCTSTR pstrText);
		void SetMaxChar(UINT uMax);
		UINT GetMaxChar();
		int GetWindowStyls() const;
		void SetNativeEditBkColor(DWORD dwBkColor);
		DWORD GetNativeEditBkColor() const;

		void SetSel(long nStartChar, long nEndChar);
		void SetSelAll();
		void SetReplaceSel(LPCTSTR lpszReplace);

		void SetPos(RECT rc);
		void SetVisible(bool bVisible = true);
		void SetInternVisible(bool bVisible = true);
		SIZE EstimateSize(SIZE szAvailable);
		void DoEvent(TEventUI& event);

		void PaintStatusImage(HDC hDC);
		void PaintText(HDC hDC);
		void SetNextEdit(CIPEditUI*& pEdit);
		void SetFrontEdit(CIPEditUI* pEdit);
		void SetTextColor(DWORD dwColor);
	protected:
		CIPEditWnd* m_pWindow;
		
		UINT m_uButtonState;
		CDuiString m_sNormalImage;
		CDuiString m_sHotImage;
		CDuiString m_sFocusedImage;
		CDuiString m_sDisabledImage;
		DWORD m_dwEditbkColor;
		int m_iWindowStyls;
	private:
		CIPEditUI* m_pNextEdit;
		CIPEditUI* m_pFrontEdit;
		DWORD m_dwTextColor;

	};



	class UILIB_API CIPAddressUI :public CContainerUI
	{
		friend class CIPEditUI;
	public:
		CIPAddressUI();
		LPCTSTR GetClass()const;
		LPVOID GetInterface();
		CDuiString GetIPText()const;
		UINT GetIP()const;
		void SetIPText(UINT nIP);
		void SetAttribute(LPCTSTR pstrName ,LPCTSTR pstrValue);
		void SetPos(RECT rcPos);
		void SetBkColor(DWORD dwColor);
		void InitEditItem();
		//void SetPadding(RECT rcPadding);
		//void SetFixedWidth(int cx);
		//void SetFixedHeight(int cy);
		//void DoEvent(TEventUI& event);
		void AdjustPos();
		void SetFont(int nnFont);
		void SetTextColor(DWORD dwColor);
		void SetTextPadding(RECT rc);
		void SetBkImage(LPCTSTR pstrImage);
		void PaintStatusImage(HDC hDC);
		void SetFocusedImage(const TCHAR* szImage);
		void SetDotColor(DWORD dwColor);
		CIPEditUI* IsOneFocused();

	private:
		RECT m_rcTextPadding;
		int m_nWidth;
		int m_nHeight;
		CContainerUI* m_pIP;
		CIPEditUI* m_pEditItem[4];
		CContainerUI* m_pParent;
		RECT m_rcPanel;
		RECT ResetItem(CIPEditUI* pItem ,int nIndex);
		CDuiString m_sFocusedImage;
		UINT m_uState;
		DWORD m_dwDotColor;
	};
}
#endif // __IPADDRESSEDIT_H__
